import type { ElForm } from 'element-plus'



export const useFormTool = ()=>{
    const submitForm = (formEl: InstanceType<typeof ElForm> | undefined) => {
        if (!formEl) return
        console.log('formEl :>> ', formEl);
        formEl.validate((valid) => {
          if (valid) {
            console.log('submit!')
          } else {
            console.log('error submit!')
            return false
          }
        })
      }
      
       const resetForm = (formEl: InstanceType<typeof ElForm> | undefined) => {
        if (!formEl) return
        formEl.resetFields()
      }
    return {
        submitForm,resetForm
    }
}